﻿//-----------------------------------------------------------------------
// <copyright file="IFCISPlusServerCommunicator.cs" company="FCIS">
//     Company copyright tag.
// </copyright>
// <author>Ramy Medhat</author>
// <date>24/8/2011</date>
// <reviewer></reviewer>
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FCISPlus.Server.Database;

namespace FCISPlus.Server.Communicator
{
    /// <summary>
    /// FCIS+ Server Communicator Interface.
    /// </summary>
    public interface IFCISPlusServerCommunicator
    {
        /// <summary>
        /// Logins the specified username.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <returns>The session token.</returns>
        int Login(string username, string password);

        /// <summary>
        /// Gets all users.
        /// </summary>
        /// <returns>Array of users.</returns>
        User[] GetAllUsers();

        /// <summary>
        /// Gets the user.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns>The user object.</returns>
        User GetUser(int token);

        /// <summary>
        /// Logouts using the specified token.
        /// </summary>
        /// <param name="token">The token.</param>
        void Logout(int token);

        /// <summary>
        /// Signs up.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <returns>The session token.</returns>
        int SignUp(string username, string password);

        /// <summary>
        /// Gets the friends.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns>.Array of friends</returns>
        User[] GetFriends(int token);

        /// <summary>
        /// Adds the friend.
        /// </summary>
        /// <param name="friend">The friend.</param>
        /// <param name="token">The token.</param>
        void AddFriend(User friend, int token);

        /// <summary>
        /// Removes the friend.
        /// </summary>
        /// <param name="friend">The friend.</param>
        /// <param name="token">The token.</param>
        void RemoveFriend(User friend, int token);

        /// <summary>
        /// Gets the feeds.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns>Array of posts.</returns>
        Post[] GetFeeds(int token);

        /// <summary>
        /// Adds the post.
        /// </summary>
        /// <param name="postText">The post text.</param>
        /// <param name="postLink">The post link.</param>
        /// <param name="token">The token.</param>
        void AddPost(string postText, string postLink, int token);

        /// <summary>
        /// Adds the comment.
        /// </summary>
        /// <param name="commentText">The comment text.</param>
        /// <param name="post">The post.</param>
        /// <param name="token">The token.</param>
        void AddComment(string commentText, Post post, int token);

        /// <summary>
        /// Likes the specified post.
        /// </summary>
        /// <param name="post">The post.</param>
        /// <param name="token">The token.</param>
        void Like(Post post, int token);

        /// <summary>
        /// Unlikes the specified post.
        /// </summary>
        /// <param name="post">The post.</param>
        /// <param name="token">The token.</param>
        void Unlike(Post post, int token);


        /// <summary>
        /// Sends the message.
        /// </summary>
        /// <param name="friend">The friend.</param>
        /// <param name="messageText">The message text.</param> 
        /// <param name="token">The token.</param>
        void SendMessage(User friend, string messageText, int token);

        /// <summary>
        /// Gets the recent conversations.
        /// </summary>
        /// <param name="messageLifeTime">The message life time.</param>
        /// <param name="token">The token.</param>
        /// <returns></returns>
        Message[] GetRecentConversations(TimeSpan messageLifeTime, int token);

        /// <summary>
        /// Gets the conversation by friend.
        /// </summary>
        /// <param name="friend">The friend.</param>
        /// <param name="messageLifeTime">The message life time.</param>
        /// <param name="token">The token.</param>
        /// <returns></returns>
        Message[] GetConversationByFriend(User friend, TimeSpan messageLifeTime, int token);

    }
}
